package models.re.aaa;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map.Entry;


public class NodeAction extends HashMap<String,ArrayList<Integer>>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	public void addElement(String name, ArrayList<Integer> action) {
		this.put(name,action);
	}
	
	public void removeElement(String name) {
		this.remove(name);
	}
	
	public int length() {
		return this.size();
	}
	
	public ArrayList<Integer> find(String name) {		
		return this.get(name);
	}
	
	public void updateAction(String name, ArrayList<Integer> action) {
		this.remove(name);
		this.put(name, action);
	}
	
	public int sumAction(String name){
		int total = 0;
		for(int a: this.get(name)) total+=a;
		return total;
	}
	
	public int addActionValue(int a) {
		int total = 0;
		for(Entry<String,ArrayList<Integer>> entry : this.entrySet()) {
			total+=entry.getValue().get(a);
		}
		return total;
	}

}
